/*     */ package com.lmpop.trade.ti_comm_give;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.dao.IbatisDbmImpl;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.frame.util.RandomID;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_comm_giveInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_comm_giveInfo()
/*     */   {
/*  17 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  27 */     Ti_comm_giveInfo ti_comm_giveInfo = new Ti_comm_giveInfo();
/*  28 */     String comm_code = map.getString("comm_code");
/*  29 */     if ((comm_code != null) && (!"".equals(comm_code))) {
/*  30 */       insertmore(dbmMgr, map);
/*     */     }
/*     */     else
/*     */     {
/*  34 */       RandomID randId = new RandomID();
/*  35 */       String trade_id = randId.GenTradeId();
/*  36 */       String ran_comm_code = randId.GenTradeId();
/*  37 */       Ti_comm_give ti_comm_give = new Ti_comm_give();
/*  38 */       ti_comm_give.setTrade_id(trade_id);
/*  39 */       ti_comm_give.setComm_code(ran_comm_code);
/*  40 */       ti_comm_give.setReg_cust_id(map.getString("cust_id"));
/*  41 */       ti_comm_give.setIn_date(map.getString("in_date"));
/*     */ 
/*  43 */       String result_code = "0";
/*     */       try {
/*  45 */         insert(dbmMgr, ti_comm_give);
/*     */       } catch (ApplicationException e) {
/*  47 */         e.printStackTrace();
/*  48 */         result_code = "1";
/*     */       }
/*  50 */       map.setString("result_code", result_code);
/*     */     }
/*  52 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_comm_give ti_comm_give)
/*     */     throws ApplicationException
/*     */   {
/*  62 */     dbmMgr.update("insertTi_comm_give", ti_comm_give);
/*     */   }
/*     */ 
/*     */   public SysMap insertmore(DbmInterf dbmMgr, SysMap map) {
/*  66 */     Ti_comm_give ti_comm_give = new Ti_comm_give();
/*     */ 
/*  68 */     RandomID randId = new RandomID();
/*  69 */     String trade_id = randId.GenTradeId();
/*  70 */     ti_comm_give.setComm_code(map.getString("comm_code"));
/*  71 */     ti_comm_give.setTrade_id(trade_id);
/*  72 */     ti_comm_give.setComm_cust_id(map.getString("comm_cust_id"));
/*  73 */     ti_comm_give.setReg_cust_id(map.getString("cust_id"));
/*  74 */     ti_comm_give.setComm_url(map.getString("comm_url"));
/*     */ 
/*  76 */     String result_code = "0";
/*     */     try {
/*  78 */       insertmore(dbmMgr, ti_comm_give);
/*     */     } catch (ApplicationException e) {
/*  80 */       e.printStackTrace();
/*  81 */       result_code = "1";
/*     */     }
/*  83 */     map.setString("result_code", result_code);
/*  84 */     return map;
/*     */   }
/*     */ 
/*     */   public void insertmore(DbmInterf dbmMgr, Ti_comm_give ti_comm_give)
/*     */     throws ApplicationException
/*     */   {
/*  94 */     dbmMgr.update("insertmoreTi_comm_give", ti_comm_give);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 105 */     RandomID randId = new RandomID();
/* 106 */     String ran_comm_code = randId.GenTradeId();
/* 107 */     Ti_comm_give ti_comm_give = new Ti_comm_give();
/*     */ 
/* 109 */     ti_comm_give.setComm_code(ran_comm_code);
/* 110 */     ti_comm_give.setComm_cust_id(map.getString("comm_cust_id"));
/* 111 */     ti_comm_give.setReg_cust_id(map.getString("cust_id"));
/* 112 */     ti_comm_give.setComm_url(map.getString("comm_url"));
/*     */ 
/* 115 */     String result_code = "0";
/*     */     try {
/* 117 */       update(dbmMgr, ti_comm_give);
/*     */     } catch (ApplicationException e) {
/* 119 */       e.printStackTrace();
/* 120 */       result_code = "1";
/*     */     }
/* 122 */     map.setString("result_code", result_code);
/* 123 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_comm_give ti_comm_give)
/*     */     throws ApplicationException
/*     */   {
/* 132 */     dbmMgr.update("updateTi_comm_give", ti_comm_give);
/*     */   }
/*     */ 
/*     */   public SysMap updateCommStateByOnliePay(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 137 */     String result_code = "0";
/*     */     try {
/* 139 */       Hashtable orderMap = new Hashtable();
/* 140 */       orderMap.put("trade_state_code", map.getString("trade_state_code"));
/*     */ 
/* 142 */       updateCommStateByOnliePay(dbmMgr, orderMap);
/*     */     }
/*     */     catch (ApplicationException e) {
/* 145 */       e.printStackTrace();
/* 146 */       result_code = "1";
/*     */     }
/* 148 */     map.setString("result_code", result_code);
/* 149 */     return map;
/*     */   }
/*     */ 
/*     */   public String updateCommStateByOnliePay(Map map)
/*     */   {
/* 154 */     DbmInterf dbmMgr = new IbatisDbmImpl();
/* 155 */     List list = this.queryList.getList("getTi_comm_giveCustIdByPk", map);
/* 156 */     if ((list != null) && (list.size() > 0)) {
/* 157 */       Map mapt = (Hashtable)list.get(0);
/* 158 */       if ((mapt.get("trade_state_code") != null) && (mapt.get("trade_state_code").equals("1"))) {
/* 159 */         return "0";
/*     */       }
/* 161 */       map.put("reg_cust_id", mapt.get("reg_cust_id"));
/* 162 */       dbmMgr.updateSql("updateCommStateTi_comm_giveinfo", map);
/* 163 */       return "1";
/*     */     }
/*     */ 
/* 166 */     return "0";
/*     */   }
/*     */ 
/*     */   public void updateCommStateByOnliePay(DbmInterf dbmMgr, Hashtable map)
/*     */     throws ApplicationException
/*     */   {
/* 173 */     dbmMgr.update("updateCommStateTi_comm_giveinfo", map);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map) {
/* 177 */     String pkid_string = map.getString("pkid");
/* 178 */     String result_code = "0";
/*     */     try {
/* 180 */       if (!pkid_string.equals("")) {
/* 181 */         String[] pkStr = pkid_string.split("\\|");
/* 182 */         for (int i = 0; i < pkStr.length; i++) {
/* 183 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/* 187 */       e.printStackTrace();
/* 188 */       result_code = "1";
/*     */     }
/* 190 */     map.setString("result_code", result_code);
/* 191 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 200 */     dbmMgr.update("deleteTi_comm_give", pkid);
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 205 */     return this.queryList.getList("getTi_comm_giveByPk", pk);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj) {
/* 209 */     Hashtable ti_comm_give = (Hashtable)obj;
/* 210 */     List list = this.queryList.getList("getCountByObjTi_comm_give", ti_comm_give);
/* 211 */     int count = 0;
/* 212 */     if ((list != null) && (list.size() > 0)) {
/* 213 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 214 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 215 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 218 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit) {
/* 222 */     Hashtable ti_comm_give = (Hashtable)obj;
/* 223 */     if (start == 0)
/* 224 */       start = 0;
/*     */     else {
/* 226 */       start = (start - 1) * limit;
/*     */     }
/* 228 */     ti_comm_give.put("start", Integer.valueOf(start));
/* 229 */     ti_comm_give.put("limit", Integer.valueOf(limit));
/* 230 */     return this.queryList.getList("getListByTi_comm_gP", ti_comm_give);
/*     */   }
/*     */ 
/*     */   public String getCustIDByCom(String user_id) {
/* 234 */     List custList = this.queryList.getList("getCustIDByCom", user_id);
/* 235 */     String reg_cust_id = "";
/* 236 */     Hashtable custMap = new Hashtable();
/* 237 */     if ((custList != null) && (custList.size() > 0)) custMap = (Hashtable)custList.get(0);
/* 238 */     if (custMap.get("reg_cust_id") != null) reg_cust_id = custMap.get("reg_cust_id").toString();
/* 239 */     return reg_cust_id;
/*     */   }
/*     */ 
/*     */   public String getCommIDByCom(String user_id) {
/* 243 */     List custList = this.queryList.getList("getCommIDByCom", user_id);
/* 244 */     String comm_cust_id = "";
/* 245 */     Hashtable custMap = new Hashtable();
/* 246 */     if ((custList != null) && (custList.size() > 0)) custMap = (Hashtable)custList.get(0);
/* 247 */     if (custMap.get("comm_cust_id") != null) comm_cust_id = custMap.get("comm_cust_id").toString();
/* 248 */     return comm_cust_id;
/*     */   }
/*     */ 
/*     */   public String getStateCodeByCustId(String user_id) {
/* 252 */     List custList = this.queryList.getList("getStateCodeByCustId", user_id);
/* 253 */     String trade_state_code = "";
/* 254 */     Hashtable custMap = new Hashtable();
/* 255 */     if ((custList != null) && (custList.size() > 0)) custMap = (Hashtable)custList.get(0);
/* 256 */     if (custMap.get("trade_state_code") != null) trade_state_code = custMap.get("trade_state_code").toString();
/* 257 */     return trade_state_code;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_comm_give.Ti_comm_giveInfo
 * JD-Core Version:    0.6.0
 */